trigger LeadEmailUpdate on Lead (after update) {

	Map<Id, Lead> newleads = new Map<Id, Lead>(trigger.new);
	Map<Id, Lead> oldLeads = new Map<Id, Lead>(trigger.old);
	Map<Id, Lead> changedLeads = new Map<Id, Lead>();
	
	for (Id key : newLeads.keySet()) {
		Lead newLead = newLeads.get(key);
		Lead oldLead = oldLeads.get(key);
		if (newLead.email != oldLead.email) {
			changedLeads.put(newLead.Id, newLead);
		}
	}
	
	List<MeetingInvitees__c> inv = [Select Id, Email__c From MeetingInvitees__c Where Lead__c in :changedLeads.keySet()];
	for (MeetingInvitees__c mi : inv) {
		mi.Email__c = changedLeads.get(mi.Lead__c).Email;
	}
	
	List<MeetingAttendees__c> att = [Select Id, Email__c From MeetingAttendees__c Where Lead__c in :changedLeads.keySet()];
	for (MeetingAttendees__c ma : att) {
		ma.Email__c = changedLeads.get(ma.Lead__c).Email;
	}
	
	update inv;
	update att;
	
}